package com.xinsoft.common;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;

import java.io.Serializable;
import java.util.Date;

/**
 * 文件名称： .BaseEntity.java</br>
 * 初始作者： hsm</br>
 * 创建日期： 2023</br>
 * 功能说明： 实体基类 <br/>
 * =================================================<br/>
 * 修改记录：<br/>
 * 修改作者 日期 修改内容<br/>
 * ================================================<br/>
 * Copyright (c) 2019-2020 .All rights reserved.<br/>
 */
@Data
@ApiModel
public abstract class BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID", notes = "")
    @TableId(value = "id",type = IdType.AUTO)
    protected Integer id;

    /**
     * 操作标志(0-正常，1-刪除)
     */
    @ApiModelProperty(value = "操作标志(0-正常，1-刪除)", notes = "")
    @TableLogic
    @TableField(fill = FieldFill.INSERT,updateStrategy = FieldStrategy.NOT_NULL)
    private Integer doDelete;

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人", notes = "")
    @TableField(fill = FieldFill.INSERT,updateStrategy = FieldStrategy.NOT_NULL)
    private Integer createBy;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间", notes = "")
    @TableField(fill = FieldFill.INSERT,updateStrategy = FieldStrategy.NOT_NULL)
    private Date createTime;

    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人", notes = "")
    @TableField(fill = FieldFill.INSERT_UPDATE,updateStrategy = FieldStrategy.NOT_NULL)
    private Integer updateBy;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间", notes = "")
    @TableField(fill = FieldFill.INSERT_UPDATE,updateStrategy = FieldStrategy.NOT_NULL)
    private Date updateTime;

    public void setId(Integer id) {
        this.id = id;
    }

    public void removeId() {
        this.id = null;
    }

}
